package com.student.dong.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteFileService;
import com.ruoyi.system.api.domain.SysFile;
import com.student.dong.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;
import java.util.Map;

/**
 * @Program: animalSystem->AuthenticationOssController
 * @Description:
 * @Author: donghang
 * @Date: 2023-03-22 16:26
 * @Version： 1.0
 **/
@RestController
@RequestMapping("/oss")
public class AuthenticationOssController {

    @Autowired
    private RemoteFileService remoteFileService;

    @RequestMapping("/upload")
    public Result upload(@RequestPart("file")MultipartFile file){
        R<SysFile> upload = remoteFileService.upload(file);
        String url = upload.getData().getUrl();
        return Result.ok().data("url",url);
    }
}
